package com.nebrija.riif.model;

import java.util.List;
import java.util.Arrays;

/**
 * Class to represent enum types in the grammar such as those used in input and output parameters
 * @author asanchep
 *
 */
public class EnumType {
	/** possible values */
	private List<String> values;
	/** current value */
	private String currentValue;
	
	public EnumType(String defaultValue, String... values){
		this.values = Arrays.asList(values);
		this.currentValue=defaultValue;
	}
	
	public String getCurrentValue() {
		return currentValue;
	}

	public void setCurrentValue(String defaultValue) {
		this.currentValue = defaultValue;
	}

	public List<String> getValues() {
		return values;
	}

	/**
	 * Check if a string matches a possible value  
	 * @param value the string to be matched against possible value
	 * @return true if it is an accepted value, false otherwise
	 */
	public boolean isValue(String value){
		if(values.contains(value)){
			return true;
		}
		return false;
	}
}
